//百度坐标转高德（传入经度、纬度）
export const bd_decrypt = (
  bd_lng: number,
  bd_lat: number,
): {
  lng: number;
  lat: number;
} => {
  const X_PI = (Math.PI * 3000.0) / 180.0;
  const x = bd_lng - 0.0065;
  const y = bd_lat - 0.006;
  const z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * X_PI);
  const theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * X_PI);
  const gg_lng = z * Math.cos(theta);
  const gg_lat = z * Math.sin(theta);
  return {
    lng: gg_lng,
    lat: gg_lat,
  };
};
